<template>
	<div>
		<el-form
		  :inline="true"
		  size="small"
		  class="demo-form-inline"
		>


        <el-form-item
          :label="item.lable"
          v-for="(item,index) in formArr"
          :key="index"
          v-if="item.lable != '' && item.lable != null"
        >
          <template v-if="item.lable != '' && item.lable != null">
          <!--输入框-->
          <el-input
            v-if="item.type == 0"
            v-model="formData[index].value"
            :placeholder="item.lable"
            class="inputWidth"
          ></el-input>

          <!--日期框-->
          <el-date-picker
            v-if="item.type == 1"
            v-model="formData[index].searchTypeForDateDto.start"
            type="date"
            placeholder="开始日期"
            value-format="yyyy-MM-dd"
            class="inputWidth"
          >
          </el-date-picker>
          <span v-if="item.type == 1" >至</span>
          <el-date-picker
            v-if="item.type == 1"
            v-model="formData[index].searchTypeForDateDto.end"
            type="date"
            placeholder="结束日期"
            value-format="yyyy-MM-dd"
            class="inputWidth"
          >
          </el-date-picker>

          <!--时分秒日期框-->
          <el-date-picker
            v-if="item.type == 5"
            v-model="formData[index].searchTypeForDateDto.start"
            type="datetime"
            placeholder="开始日期"
            value-format="yyyy-MM-dd HH:mm:ss"
            class="dateInputWidth"
          >
          </el-date-picker>
          <span v-if="item.type == 5" >至</span>
          <el-date-picker
            v-if="item.type == 5"
            v-model="formData[index].searchTypeForDateDto.end"
            type="datetime"
            placeholder="结束日期"
            value-format="yyyy-MM-dd HH:mm:ss"
            class="dateInputWidth"
          >
          </el-date-picker>

          <!--下拉框-->
          <el-select
            v-else-if="item.type == 6"
            class="inputWidth"
            v-model="formData[index].value"
          >
            <el-option value=""></el-option>
            <el-option
              v-for="item2 in item.searchTypeForSelectDtos"
              :key="item2.value"
              :label="item2.showValue"
              :value="item2.value"
            ></el-option>
          </el-select>

          <!--下拉框-->
          <el-select
            v-else-if="item.type == 8"
            class="inputWidth"
            v-model="formData[index].value"
          >
            <el-option value=""></el-option>
            <el-option
              v-for="item2 in item.searchTypeForSelectDtos"
              :key="item2.value"
              :label="item2.showValue"
              :value="item2.value"
            ></el-option>
          </el-select>

          </template>
        </el-form-item>


		  <el-form-item>
		    <el-button icon="el-icon-search" type="primary" @click="onSubmit"
		      >查询</el-button
		    >
		  </el-form-item>
		</el-form>
	</div>
</template>

<script>
	export default{
		props:["tablid","module"],
		data(){
			return {
				formArr:[],
				formData:[]
			};
		},
		created(){
			this.getData();
		},
		methods:{
			async getData(){
				let res = await api.queryBody("/admin/api/system/SystemCommonBusinessController/getSearchInputDisplayFields",{id:this.tablid,module:this.module})
				this.formArr = res.data;
				this.formData = res.data;
			},
			onSubmit(){
				this.$emit("f_search",this.formData);
			}
		}

	}
</script>

<style lang="scss" scoped>
.inputWidth{
	width: 160px;
}
.dateInputWidth{
	width: 190px;
}
</style>>
